<template>
  <div class="person">
  <h2>一辆{{car.brand}}价值为{{car.price}}万</h2>
    <button @click="changePrice">修改价格</button>
    <h2>游戏列表</h2>
    <ul>
      <li v-for="item in games" v-bind:key="item.id">
        游戏Id {{item.id}} 游戏名称Name{{item.name}}
      </li>
    </ul>
    <button @click="changeFirstGame">修改第一个游戏的名字</button>
  </div>
</template>
<script lang="ts" setup name="Person1">
  import {reactive} from "vue";

  let car = reactive({brand: "奔驰", price: 200});
  let games = reactive([
    {id : '1', name: '王者荣耀'},
    {id : '2', name: '英雄联盟'},
    {id : '3', name: 'QQ飞车'}
  ])
  console.log(car)
  console.log(games)
  function changePrice () {
    car.price += 10
  }


  function changeFirstGame() {
    games[0].name = "剑灵"
  }
</script>
<style>
.person {
  background-color: #ddd;
  box-shadow: 0 0 10px;
  border-radius: 10px;
  padding: 20px;
}

button {
  margin: 5px;
}

li {
  font-size: 20px;
}
</style>